<?php 
	session_start();
	include("ketnoi.php");
?>
<div class="main">

	<h5>TIN TỨC & SỰ KIỆN<HR ></h5>

</div>
<?php	
	$query = "select * from `".$dulieu."`.`tintuc`  order by MaTT desc";	
	$kq = mysql_query($query);
	$tong=mysql_num_rows($kq);
	$sotrang = ceil($tong/20);
	
	if(isset($_REQUEST['trang']))
		$trang = $_REQUEST['trang'];
	else 
		$trang = 1;
	$dem = -1;

if($tong>0)
{
?>
<div style="margin:0 10px;padding-top:0px; font-family:'Times New Roman', Times, serif">
 <?php
	while($row = mysql_fetch_array($kq))
	{
		$dem++;
		if($dem >= ($trang-1)*20 && $dem <= ($trang*20)-1)
		{ 
		?>
		<div class="news_content" style="padding-right:10px; padding-left:20px">
	<div class="news_header"><a style="color:#FFF; text-decoration:none" href="c01<?php echo $row["MaTT"]?>.html" title="<?php echo $row['TieuDeTT']?>"><?php echo catchuoi($row['TieuDeTT'],0,110)?></a></div>  	 	 	 
	<div class="padding" style="padding-left:20px; font-style:italic; font-size:12px"> Ngày đăng : 
	<?php  echo substr($row['NgayDang'],8,2)."/".substr($row['NgayDang'],5,2)."/".substr($row['NgayDang'],0,4).' &nbsp;';  ?></div>
		<table class="news_detail">
		<tbody>
		<tr>
        
			<td>
				&nbsp;
			</td>
		</tr>
	</tbody></table>
</div>
		<?php
		}
	}
		?>
</div>
<?php 
if($sotrang > 1){
?>
<div style="padding: 10px;">
<table class="page" width="100%"><tr>
			<td width="100%" align="left" class="trang">
			<?php if($trang >1){?> <a href="tintuc-p<?php echo $trang-1?>.html">« back</a>...<?php } 
			
					for($i=1; $i<=$sotrang; $i++)
					{ 
					echo " | ";
					if($trang == $i) echo '<b>';
					?>
					
					  <a  href="tintuc-p<?php echo $i?>.html"><?php echo $i ?> </a><?php if($trang == $i) echo '</b>'; 
					  
					}
					echo " | ";
					if($trang < $sotrang){?>...<a href="tintuc-p<?php echo $trang+1?>.html">next »</a> <?php }?>	</td>
  		</tr>
	</table>
</div>
<?php
}

}
?>
